
//添加
$(function () {
    $("#add").click(function () {
        let department = $(".department").val().trim();
        let status = $(".status").val().trim();
        let position = $(".position").val().trim();
        let positionid = $(".positionid").val().trim();
        let name = $(".name").val().trim();
        let sex = $(".sex").val().trim();
        let email = $(".email").val().trim();
        let pohone = $(".pohone").val().trim();
        let address = $(".address").val().trim();
        let cardid = $(".cardid").val().trim();
        let originalHome = $(".originalHome").val().trim();
        let politicsStatus = $(".politicsStatus").val().trim();
        let school = $(".school").val().trim();
        let specialty = $(".specialty").val().trim();
        let educationBackground = $(".educationBackground").val().trim();
        let salary = $(".salary").val().trim();
        let openingBank = $(".openingBank").val().trim();
        let cardNumbers = $(".cardNumbers").val().trim();
        let socialNumbers = $(".socialNumbers").val().trim();
        let registrant = $(".registrant").val().trim();
        let inputtingTime = $(".inputtingTime").val().trim();
        let curriculumVitae = $(".curriculumVitae").val().trim();
        let FamilyInformation = $(".FamilyInformation").val().trim();
        let comment = $(".comment").val().trim();
        let attachment = $(".attachment").val().trim();

        if (department == "" || status == "" || position == "" || positionid == "" || name == "" || sex == "" || email == "" || pohone == "" ||
            address == "" || cardid == "" || originalHome == "" || politicsStatus == "" || school == "" || specialty == "" || educationBackground == "" ||
            salary == "" || openingBank == "" || cardNumbers == "" || socialNumbers == "" || registrant == "" || inputtingTime == "" || curriculumVitae == ""
            || FamilyInformation == "" || comment == "") {
            alert("所选内容均不能为空。请填写内容！")
            return;
        }

        let jsonA = {
            department: department,
            position: position,
            status: status,
            positionid: positionid,
            name: name,
            sex: sex,
            email: email,
            pohone: pohone,
            address: address,
            cardid: cardid,
            originalHome: originalHome,
            politicsStatus: politicsStatus,
            school: school,
            specialty: specialty,
            educationBackground: educationBackground,
            salary: salary,
            openingBank: openingBank,
            cardNumbers: cardNumbers,
            socialNumbers: socialNumbers,
            registrant: registrant,
            inputtingTime: inputtingTime,
            curriculumVitae: curriculumVitae,
            FamilyInformation: FamilyInformation,
            comment: comment,
            attachment: attachment
        }

        var formData = new FormData($('#jjb')[0]);

        $.ajax({
            type: 'post',
            url: "/save",
            data: formData,
            cache: false,

            processData: false,
            contentType: false,
            success: function (dataA) {

                if (dataA == "true") {
                    alert("添加成功")
                    location.href = "/人事档案管理"
                } else {
                    alert("添加失败")

                }

            }
        })
    })
})
